import moment from 'moment'
import 'moment/locale/zh-cn'
import Header from '@/views/box/components/layouts/Header'

export const taskMixin = {
  components: { Header },
  data () {
    return {
      typeArr: [
        { text: '签到', code: 0, enText: 'sign' },
        { text: '订单评价', code: 1, enText: 'comment' },
        { text: '社区发帖', code: 2, enText: 'post' },
        { text: '自定义', code: 3, enText: 'custom-links' }
      ],
      brandList: [
        { brandName: "江南布衣信息中心", weid: "100", arcBrandId: "2" },
        { brandName: "JNBY", weid: "2738574294", arcBrandId: "2" },
        { brandName: "LESS", weid: "2822095692", arcBrandId: "5" },
        { brandName: "速写", weid: "2504948039", arcBrandId: "3" },
        { brandName: "jnby by JNBY", weid: "4", arcBrandId: "4" },
        { brandName: "蓬马", weid: "6924108367", arcBrandId: "12" },
        { brandName: "APN73", weid: "15", arcBrandId: "57" },
        { brandName: "JNBYHOME", weid: "8348044436", arcBrandId: "17" },
        { brandName: "江南布衣+", weid: "5", arcBrandId: "67" },
        { brandName: "江南布衣Outlet", weid: "11", arcBrandId: "9999" }
      ],
      brandListPro: [
        // { brandName: "江南布衣信息中心", weid: "100", arcBrandId: "2" },
        { brandName: "JNBY", weid: "2738574294", arcBrandId: "2" },
        { brandName: "LESS", weid: "2822095692", arcBrandId: "5" },
        { brandName: "速写", weid: "2504948039", arcBrandId: "3" },
        { brandName: "jnby by JNBY", weid: "4", arcBrandId: "4" },
        { brandName: "蓬马", weid: "6924108367", arcBrandId: "12" },
        { brandName: "APN73", weid: "15", arcBrandId: "57" },
        { brandName: "JNBYHOME", weid: "8348044436", arcBrandId: "17" },
        { brandName: "江南布衣+", weid: "5", arcBrandId: "67" },
        { brandName: "江南布衣Outlet", weid: "11", arcBrandId: "9999" }
      ]
    }
  },
  filters: {
    typeName (v, typeArr) {
      if (v != null && v != undefined) {
        return typeArr.filter(e => e.code == v)[0].text + '任务'
      }
      return v
    },
    brandName (v, list) {
      if (v) {
        let result = list.filter(e => e.weid == v)
        if (result.length) {
          return result[0].brandName
        }
      }
      return v
    },
    taskTypeName (v, list) {
      if (v != null && v != undefined) {
        return list.filter(e => e.code == v)[0].text + '任务'
      }
      return v
    },
  },
  methods: {
    moment,
    headerBack () {
      this.$router.back()
    },

  },
}